home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-17 | 9.4 KB | 276 lines | [TEXT/MPS ] |
- #
- # check-disk
- # MPW Shell script
- # Malcolm H. Teas
- # Apple Computer, Inc.
- #
- # Function:
- # Compare two disks or folders, file by file, all the resources and data
- # forks. Also compare the file attributes too. Generate a report showing
- # the differences between the two disks or folders. The report lists the
- # differences file by file.
- #
- # In-Outputs:
- # The only input parameter is a single character. Either "d" or "f" for
- # "disk" or "folder" modes. There are no ouput parameters excepting the
- # parameter used by exit. The exit status will be "2" if the script exits
- # with an error.
- # The output report is generated by this script and the scripts/tools
- # that it calls. This output is written to the current MPW window.
- #
- # Notes:
- # Calls makelist and compare-disks scripts.
- #
-
- # Save the value of some MPW globals, restore at the end.
- set save-exit {exit}
- set exit 0 # exit=1 for exit on program error
- set save-echo {echo}
- set echo 0 # echo=1 for echoing each command before execution
- echo # Print blank line to seperate the report from stuff.
- echo "____________________________________________________________________________"
- echo
- echo "∂t∂t∂t∂t∂t∂tWelcome to the Localization Verifier"
- echo
- echo "The Localization Verifier will compare a US Master folder with a Localized"
- echo "folder. A three part report will be generated for each of the files that are"
- echo "being compared. The header for each of these reports looks like the following: "
- echo
- echo "--------------------------------------------------------------------------------"
- echo "The following resources SHOULD NOT have differences but ARE different: "
- echo "--------------------------------------------------------------------------------"
- echo
- echo "∂t∂t∂t∂t∂**Resource specific information will go here **"
- echo
- echo "--------------------------------------------------------------------------------"
- echo "The following resources SHOULD have differences but do not (not yet localized?): "
- echo "--------------------------------------------------------------------------------"
- echo
- echo "∂t∂t∂t∂t∂**Resource specific information will go here **"
- echo
- echo "--------------------------------------------------------------------------------"
- echo "The following resources MAY or MAY NOT have differences."
- echo "This list is for your information only:"
- echo "--------------------------------------------------------------------------------"
- echo
- echo "∂t∂t∂t∂t∂**Resource specific information will go here **"
- echo
- echo "Primary differences in the reports will look like:"
- echo " indm 999, Contents match. They should differ. Not translated yet?"
- echo
- echo "Currently ∂"secondary∂" data comparision information will be interspersed throughout"
- echo "each of the three reports. Secondary comparisons include the data fork, file attribute"
- echo "flags, resource file attribute flags, resource map flags, and finder attribute"
- echo "flags. Look for three stars (***) at the beginning of a line to signal a secondary"
- echo "difference."
- echo
- echo "Missing resources will also be reported. They will look like this:"
- echo
- echo "∂t*MISSING* Master file does not contain the following resource: itlk 9"
- echo
- echo "A perfect compare would report nothing. It is also possible that *MISSING*"
- echo "resources should be missing from either the US or localized files. This"
- echo "must be verified by the user."
- echo
- echo "•--------------------------------------------------------------------------------•"
- echo " Begin Report - `date`"
- echo "•--------------------------------------------------------------------------------•"
- echo
-
-
- # Get the disk/folder ("d" or "f") parameter.
- set folder "{1}"
-
- # Do we have a list of the file correspondences? If not, make one.
- confirm -t "Make a correspondences file list?"
- set sstatus {status} # Save the status
- if {sstatus} == 5 # Cancel button.
- set exit {save-exit}
- set echo {save-echo}
- exit 2
-
- # The Yes button, set the name of the file and make the list.
- else if {sstatus} == 0
- set filelist "`getfilename -q -m "Name a filelist" -b "New" -p ":Untitled filelist" || ∂
- set ssstatus {status}`" # Cancel button.
- if {ssstatus} != 0
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end # end of if cancel
- echo "Creating new filelist: " "{filelist}"
-
- makelist "{filelist}" "{folder}" # Make the list.
- if {status} != 0 # Cancel button in makelist
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end
-
- # The No button, select an existing file to use.
- else if {sstatus} == 4
- set filelist "`getfilename -q -b Select -m "Select the correspondences file." || ∂
- set ssstatus {status}`" # Cancel button for select.
- if {ssstatus} != 0
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end # end of if cancel
- echo "Using existing filelist: " "{filelist}"
- end
-
-
- # Check for the disks being inserted.
- open "{filelist}"
- find • "{filelist}"
- find /•≈∞/ "{filelist}" # Get a line from filelist.
- if `count -l "{filelist}.§"` == 0 # Error if no file.
- echo "Bad filelist."
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end # End of bad filelist.
- set aFile "`catenate "{filelist}.§"`"
- set problem 0 # A sentinel.
-
- # I came across a bug where the "aFile" variable needs a leading ":" when
- # dealing with folder compares for the "exists" test. So this is now special cased here.
- # Kerry Laidlaw 1/31/90
-
- if "{folder}" == f
- set OldaFile "{aFile}"
- set aFile ":{aFile}"
- end
-
- # debugging here... echo {afile}
-
- if !`exists "{aFile}"`
- alert "Cannot find the master files. Please insert the master disk∂
- or load the folder onto your system. Then restart the command from the menu."
- set problem 1
- end
- find /•≈∞/ "{filelist}" # Get a line from filelist.
- if `count -l "{filelist}.§"` == 0 # Error if no file.
- echo "Bad filelist."
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end # End of bad filelist.
- set aFile "`catenate "{filelist}.§"`"
-
- # I came across a bug where the "aFile" variable needs a leading ":" when
- # dealing with folder compares for the "exists" test. So this is now special cased here.
- # Kerry Laidlaw 1/31/90
-
- if "{folder}" == f
- set OldaFile "{aFile}"
- set aFile ":{aFile}"
- end
-
- # Following commented out so as not to reqire the test files to exist.
- # This allows only those files in the test folder to be compared
- #if !`exists "{aFile}"`
- # alert "Cannot find the test files. Please insert the test disk∂
- # or load the folder onto your system. Then restart the command from the menu."
- # set problem 1
- #end
-
- # Now set the aFile variable back the way it was. (Really not necessary yet.) *kl*
-
- if "{folder}" == f
- set aFile "{OldaFile}"
- end
-
- close "{filelist}"
- if "{problem}" == 1
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end
-
- # Do we have an "rNames" folder that contains all the resource names? If not, make one. *kl*
- confirm -t "Make the rNames folder?"
- set sstatus {status} # Save the status
- if {sstatus} == 5 # Cancel button.
- set exit {save-exit}
- set echo {save-echo}
- exit 2
-
- # The Yes button, set the name of the file and make the list.***** Needs a lot of work!! *kl*
- # The "rNames" files need to be created
- else if {sstatus} == 0
- set rNames "`getfilename -d -q -m "Set directory for rNames folder." || ∂
- set ssstatus {status}`" # Cancel button.
- if {ssstatus} != 0
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end # end of if cancel
- echo "Creating new rNames folder: " "{rNames}"rNames
- echo
- NewFolder "{rNames}"rNames # Make the rNames folder.
- if {status} != 0 # The Folder creation was not successful
- echo "The rNames folder creation was not successful."
- echo "Try deleting it from the Finder and running Audit again."
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end
- set rNames "{rNames}"rNames: # Update rNames to include the folder name itself.
-
- # Now let's go create all the .rNames.S files....
- # To flag the "compare-disks" routine that we only wish to create the rNames files
- # let's set what is supposed to be the {folder} variable to 'zf' or 'zd' appropriately....
- if ({folder} == "f")
- set folder "zf"
- else
- set folder "zd"
- end
- compare-disks "{filelist}" "{folder}" "{rNames}" # And finally, create all the .rNames.S files....
- exit 0 # Exit for now so the Verifier Editor Stack can be used to edit the rNames files.
-
- # Now set the folder var back so the next call of compare-disks will
- # do the comparisions rather than do the special casing of generating
- # the rNames files...
-
- # Do we ever execute this code???? Wouldn't seem likely!
-
- echo "Wow! I never thought this would display!"
-
- if ({folder} == "zf")
- set folder "f"
- else
- set folder "d"
- end
-
- # The No button, select an existing rNames folder to use.
- else if {sstatus} == 4
- set rNames "`getfilename -d -q -m "Set directory to rNames folder." || ∂
- set ssstatus {status}`" # Cancel button for select.
- if {ssstatus} != 0
- set exit {save-exit}
- set echo {save-echo}
- exit 2
- end
- echo "Using existing rNames folder: " "{rNames}"
- end
-
- # Compare the files.
- echo # Add blank line to output.
- compare-disks "{filelist}" "{folder}" "{rNames}" # And finally, do the comparison.
- if "{folder}" == d # If they are disks, eject them.
- eject 1 2
- end
-
- # Cleanup and exit.
- set exit {save-exit}
- set echo {save-echo}
-
- echo
- echo "•--------------------------------------------------------------------------------•"
- echo " End Report - `date`"
- echo "•--------------------------------------------------------------------------------•"
- echo
- beep 1e,4; beep 1c,5 # Make a pleasant tone to say I'm done.
- exit 0
-